﻿using EntityModels.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntityModels.DbContexts
{
    /// <summary>
    /// 无键实体类型
    /// </summary>
    public class KeylessDbContext : DbContext
    {
        public DbSet<KeyLessEntity> KeyLessEntities => Set<KeyLessEntity>();

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<KeyLessEntity>()
                // 配置为无键实体
                .HasNoKey();
        }

    }
}
